package com.tgu.home_action.service;

import com.tgu.home_action.pojo.Admin;
import com.tgu.home_action.pojo.ResponseData;
import com.tgu.home_action.pojo.Volunteer;
import com.tgu.home_action.pojo.VolunteerInformation;
import com.tgu.home_action.pojo.exception.IMException;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.IOException;

@Validated
public interface VolunteerService {
    /**
     * 登录
     *
     * @param code：微信获取的code
     * @return responseData
     */
    ResponseData<Volunteer> login(@NotNull(message = "code不能为空") String code);

    /**
     * 更新微信获取的用户信息
     *
     * @param volunteerUser：当前登录的用户
     * @return responseData
     */
    ResponseData<Object> updateUserinfo(@NotNull(message = "encryptedData不能为空") String encryptedData, @NotNull(message = "iv不能为空") String iv, Volunteer volunteerUser);

    /**
     * 更新Token
     */
    ResponseData<Object> refreshToken(@NotNull(message = "refreshToken不能为空") String refreshToken);

    /**
     * 绑定手机号时获取验证码
     */
    ResponseData<Object> getBindCode(String phone, Volunteer volunteerUser);

    /**
     * 修改手机号时获取验证码
     */
    ResponseData<Object> getUpdateCode(String phone, Volunteer volunteerUser);

    /**
     * 绑定手机号
     */
    ResponseData<Object> bindPhone(@NotNull(message = "phone不能为空") @Pattern(regexp = "^[1]([3-9])[0-9]{9}$", message = "手机号格式错误") String phone, @NotNull(message = "code不能为空") String code, Volunteer volunteerUser);

    /**
     * 上传照片
     */
    ResponseData<String> uploadPhoto(MultipartFile photo, Volunteer volunteerUser) throws IOException;

    /**
     * 更换头像
     */
    ResponseData<String> updateAvatar(@NotNull(message = "avatarUrl不能为空") String avatarUrl, Volunteer volunteerUser);

    /**
     * 获取志愿者数量
     *
     * @param volunteerInformation
     */
    ResponseData<Integer> getVolunteerNumber(VolunteerInformation volunteerInformation);

    /**
     * 查询注册的志愿者数量
     * @param admin
     */
    ResponseData<Integer> getRegisterVolunteerNumber(Admin admin);

    /**
     * 获取在线的志愿者数量
     *
     * @param volunteerInformation
     */
    ResponseData<Integer> getOnlineVolunteerNumber(VolunteerInformation volunteerInformation);

    /**
     * 获取IM的UserSig
     */
    ResponseData<String> getUserSig(Volunteer volunteer) throws IMException;

    /**
     * 加入群组
     */
    ResponseData<Object> joinGroup(Integer caseId, Volunteer volunteer);
}
